package fileWorker;

import java.io.File;
import java.util.ArrayList;
import java.util.Enumeration;
import java.util.Hashtable;
import java.util.Iterator;

public class UsbOn {

	public static void main(String[] args) {
		FileReader fr = new FileReader();
		File file = new File("C:\\usbon.txt");

		ArrayList<String> list = fr.fileToList(file, "cp1251");
		Iterator<String> it = list.iterator();
		Hashtable<String, String> hash = new Hashtable<String, String>();
		while (it.hasNext()) {
			String line = (String) it.next();
			line = line.substring(0,line.indexOf("\t"));
			hash.put(line, line);
		}
		
		Enumeration<String> en = hash.elements();
		while (en.hasMoreElements()) {
			String string = (String) en.nextElement();
			System.out.println(string);
		}
		
		System.out.println(hash.size());
	}

}
